﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GZHJ.HardwareWin
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }



        /// <summary>
        /// 测试按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //PopupWinTool.弹窗工具 工具 = new PopupWinTool.弹窗工具();
                //var ret = 工具.弹出测试窗体(out string ss);
                //if (!ret)
                //{
                //    MessageBox.Show("弹出测试窗体操作失败");
                //}
                //else
                //{
                //    MessageBox.Show($"弹出测试窗体操作成功，返回结果：{ss}");
                //}

                PopupWinTool.弹窗工具 工具 = new PopupWinTool.弹窗工具();
                int 工站 = 1;
                string 端口名称 = "COM1";
                string IP地址 = "127.0.0.1";
                int IP端口号 = 502;
                int Pass按钮值 = 4;
                int Fail按钮值 = 5;
                var ret = 工具.信号发生器FM设置(工站,端口名称, IP地址, IP端口号, Pass按钮值, Fail按钮值, out string 错误信息);
                if (ret)
                {
                    MessageBox.Show("OK1");
                }
                else
                {
                    MessageBox.Show("NG1");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{ex}");
            }
        }
    }
}
